function y=peak(x)

%% const
w = 32;

%% program

y = zeros(size(x));
for i = 1 : length(x)
    lefti = max(1, i-w);
    righti = min(length(x), i+w);
    ispeak = 1;
    for j = lefti : righti
        if x(j) > x(i)
            ispeak = 0;
            break;
        end
    end
    if x(i) > 0 && ispeak
        y(i)=1;
    end
end
